<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<html>
<head>
    <title>监控明细关联配置</title>
</head>
<body menuId="4020">
<!--Action boxes-->
<div class="container-fluid">
    <hr>
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box">
                <div class="widget-title">
						<span class="icon"> <i class="fa fa-th"></i>
						</span>
                    <h5></h5>

                    <span class="label label-info">
							<a href="javascript:;" onclick="create()">添加</a>
						</span>

                    <div class="search">
                        <form method="post" id="mainForm" action="${ctx}/componentConf/monitorDetailRefConf/query">
                            <ul>
                                <li>
                                    <input type="text" name="fieldName" value="${fieldName_param}" maxlength="10"
                                           placeholder="列名" class="txt_250"/>
                                </li>
                                <li>
                                    <u:select id="measurement" data="[{value:'',text:'表名:所有'},{value:'0',text:'receive_mt_sms'},
																		{value:'1',text:'access_sms_report'},{value:'2',text:'accee_mo_sms'},
																		{value:'3',text:'access_audit_sms'},{value:'4',text:'access_intercept_sms'},
																		{value:'5',text:'access_sms_submit'},{value:'6',text:'reback_sms_submit'},
																		{value:'7',text:'channel_sms_submit'},{value:'8',text:'channel_sms_subret'},
																		{value:'9',text:'channel_sms_report'},{value:'10',text:'middleware_alarm'}]"
                                              value="${measurement_param}" showAll="false"/>
                                </li>
                                <li>
                                    <u:select id="state"
                                              data="[{value:'',text:'状态:所有'},{value:'0',text:'关闭'},{value:'1',text:'开启'}]"
                                              value="${state_param}" showAll="false"/>
                                </li>
                                <li><input type="submit" value="搜索"/></li>
                            </ul>
                        </form>
                    </div>
                </div>
                <div class="widget-content nopadding">
                    <table class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>列名</th>
                            <th>类型</th>
                            <th>所属表名</th>
                            <th>状态</th>
                            <th>描述</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <s:iterator value="jpage.data">
                            <tr>
                                <td>${id}</td>
                                <td>${fieldName}</td>
                                <td>
                                    <s:if test="fieldType eq 0">int</s:if>
                                    <s:elseif test="fieldType eq 1">double</s:elseif>
                                    <s:elseif test="fieldType eq 2">string</s:elseif>
                                </td>
                                <td>
                                    <s:if test="measurement eq 0">receive_mt_sms</s:if>
                                    <s:elseif test="measurement eq 1">access_sms_report</s:elseif>
                                    <s:elseif test="measurement eq 2">accee_mo_sms</s:elseif>
                                    <s:elseif test="measurement eq 3">access_audit_sms</s:elseif>
                                    <s:elseif test="measurement eq 4">access_intercept_sms</s:elseif>
                                    <s:elseif test="measurement eq 5">access_sms_submit</s:elseif>
                                    <s:elseif test="measurement eq 6">reback_sms_submit</s:elseif>
                                    <s:elseif test="measurement eq 7">channel_sms_submit</s:elseif>
                                    <s:elseif test="measurement eq 8">channel_sms_subret</s:elseif>
                                    <s:elseif test="measurement eq 9">channel_sms_report</s:elseif>
                                    <s:elseif test="measurement eq 10">middleware_alarm</s:elseif>
                                </td>
                                <td>
                                    <s:if test="state eq 0">关闭</s:if>
                                    <s:if test="state eq 1">开启</s:if>
                                </td>
                                <td>${remark}</td>
                                <td><s:date name="updateDate" format="yyyy-MM-dd HH:mm:ss"/></td>

                                <td>
                                    <a href="javascript:;" onclick="edit('${id}')">编辑&nbsp;&nbsp;&nbsp;</a>
                                    <a href="javascript:;" onclick="deleteConf('${id}')">删除&nbsp;&nbsp;&nbsp;</a>

                                </td>
                            </tr>
                        </s:iterator>
                        </tbody>
                    </table>
                </div>
                <u:jpage jpage="${jpage}" formId="mainForm"/>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">


    function create() {
        location.href = "${ctx}/componentConf/monitorDetailRefConf/add";
    }

    // 添加/编辑
    function edit(id) {
        location.href = "${ctx}/componentConf/monitorDetailRefConf/edit?id=" + id;
    }

    //删除
    function deleteConf(id) {
        layer.confirm('确认删除此配置吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                type: "post",
                url: "${ctx}/componentConf/monitorDetailRefConf/delete",
                data: {
                    id: id
                },
                success: function (data) {
                    if (data.code == 200) {
                        window.location.reload();
                    }else{
                        layer.msg("服务器错误，请联系管理员", {icon:2});
                        return;
                    }
                }
            });
        });
    }

</script>
</body>
</html>